package com.zhijian.warehouse.manage.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author HCG
 * @version 1.0
 * @date 2024-10-15
 */
public class ProductEnum {

    /**
     * 发卡状态枚举类
     */
    @AllArgsConstructor
    @Getter
    public enum CardStatusEnum {

        YES(1, "已发卡"),
        NO(0, "未发卡"),;

        private Integer code;
        private String desc;

        public static CardStatusEnum getByCode(Integer code) {
            CardStatusEnum[] values = CardStatusEnum.values();
            for (CardStatusEnum anEnum : values) {
                if (anEnum.getCode().equals(code)) {
                    return anEnum;
                }
            }
            return null;
        }

    }

    /**
     * 领用状态枚举类
     */
    @AllArgsConstructor
    @Getter
    public enum UseStatusEnum {

        YES(1, "已领用"),
        NO(0, "在库"),;

        private Integer code;
        private String desc;

        public static UseStatusEnum getByCode(Integer code) {
            UseStatusEnum[] values = UseStatusEnum.values();
            for (UseStatusEnum anEnum : values) {
                if (anEnum.getCode().equals(code)) {
                    return anEnum;
                }
            }
            return null;
        }

    }

    /**
     * 状态枚举类
     */
    @AllArgsConstructor
    @Getter
    public enum StatusEnum {

        NORMAL(1, "正常"),
        ERROR(2, "故障"),
        CANCEL(3, "作废"),;

        private Integer code;
        private String desc;

        public static StatusEnum getByCode(Integer code) {
            StatusEnum[] values = StatusEnum.values();
            for (StatusEnum anEnum : values) {
                if (anEnum.getCode().equals(code)) {
                    return anEnum;
                }
            }
            return null;
        }

    }

}
